from django import template
from main.models import Employee
from datetime import datetime
from news.models import News

register = template.Library()

@register.inclusion_tag('main/bdays_today.html', takes_context=True)
def show_bdaysT(context):
    context['bdays_today'] = Employee.objects.filter(birthday__day=datetime.now().day, birthday__month=datetime.now().month, dismissed=False)[:5]
    return context

@register.inclusion_tag('news/latest_news.html', takes_context=True)
def show_LNews(context):
    context['news_list'] = News.objects.all().order_by('-date')[:5]
    return context